Imports WinXound_Net.gVar

Public Class FormFindLine

    Public mSender As SCI_EDIT

    Private Sub ButtonFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonFind.Click

        Try
            Dim tmpNumber As Int32 = mNumber.Text - 1
            mSender.GotoLine(tmpNumber)
            Dim mFindPos As Int32 = mSender.GetCurrentPos
            ''mSender.LineScroll(0, tmpNumber - mSender.GetFirstVisibleLine)
            mSender.SetSelectionStart(mFindPos)
            mSender.SetSelectionEnd(mFindPos + mSender.LineLength(tmpNumber) - 2)
            mSender.SetFocus()
            Me.Close()

        Catch ex As Exception
            wxMessageError(ex.Message, "FormFindLine_KeyDown - Error")
        End Try

    End Sub

    Private Sub ButtonExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonExit.Click
        Me.Close()
    End Sub

    Private Sub FormFindLine_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

        If e.KeyCode = Keys.Escape Then
            Me.Close()

        ElseIf e.KeyCode = Keys.Return Then
            ButtonFind.PerformClick()

        End If

    End Sub

    Private Sub FormFindLine_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        mNumber.Select(0, 1)
        mNumber.Maximum = mSender.GetLineCount
    End Sub



End Class